package linkedlist.test203;

import listbyorder.utils.ListNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/15 12:35
 */
public class Solution1 {

    public ListNode removeElements(ListNode head, int val) {
        ListNode dummy = new ListNode(-1);
        dummy.next = head;
        ListNode t = dummy;
        while (t.next != null) {
            if (t.next.val == val) {
                t.next = t.next.next;
            } else {
                t = t.next;
            }
        }
        return dummy.next;
    }
}
